/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import { Request, Response } from 'express';
import { responseSuccess, ResponseItem } from '../utils';
import Mock from 'mockjs';

export default {
  'POST /wkd/AfterPay/lists': (req: Request, res: Response) => {
    const status = req.body.status;
    const data = Mock.mock({
      'list|1-30': [
        {
          id: '@id()',
          order_id: '@id()',
          waybill_no: 'SF' + '@id()',
          'brand|1': ['sfyj', 'ytyj'],
          mobile: '13453444513',
          shipper_mobile: '13453444513',
          'order_money|516.1-10': 1,
          'money|1-100': 100,
          'status|1': status == '0' ? ['0'] : ['2'], //status == '0' ? ['0', '1'] : ['2'],
          'adm_id|1-600': 600,
          adm_name: '13893636923',
          created_at: '@date()',
          update_time: '@date()',
        },
      ],
    });
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data: {
        lists: data.list,
        total: data.list.length,
      },
    };
    return res.json(result);
  },
  'POST /wkd/AfterPay/authList': (req: Request, res: Response) => {
    const data = Mock.mock({
      // 绑单状态（-1 表示取消: 0: 未授权； 1:授权中;  2;已扣款）
      // 扣款状态（0: 未扣款; 1 ：已扣款 2;扣款中）
      'list|1-2': [
        {
          order_id: '@id()',
          'status|1': ['1'], //['-1', '0', '1', '2'],
          'deduct_status|1': ['1', '2'], //['0', '1', '2'],
          'money|1-100': 100,
          'price|516.1-10': 1,
        },
      ],
    });
    const result: ResponseItem = {
      code: 0,
      msg: 'success',
      data: data.list,
    };
    return res.json(result);
  },
  'POST /wkd/AfterPay/auth': (req: Request, res: Response) => responseSuccess(req, res),
  'POST /wkd/AfterPay/againAuth': (req: Request, res: Response) => responseSuccess(req, res),
  'POST /wkd/AfterPay/payment': (req: Request, res: Response) => responseSuccess(req, res),
};
